Barakus_Helpers_FileHelper = Class.extend({ 
    init: function()
    {
    },
    fileExists: function(file)
    {
		var stream;
		var match = file.match(/^\/([^\/]+)\/./i);
		var dir = false;
		if (match) {
			dir = opera.io.filesystem.mountSystemDirectory(match[1]);			
		} else {
			dir = opera.io.filesystem.mountSystemDirectory('storage');
		}
        try{
            var stream = dir.open(file, 'r' );
			return true;
        } catch (e){
            opera.postError(e);
            return false;
        }
    },
	fileGetContents: function(file)
	{
		if (this.fileExists(file))
		{
			return safe_file_get(file);
		} else {
			throw new Error('File ' + file + ' not exists');
		}
		
		return '';
	}
});
